package com.intellagric.controller.agritech.controller.user_action;

import com.intellagric.common.pojo.LayuiDataGridResult;
import com.intellagric.common.pojo.ResponseMessage;
import com.intellagric.pojo.AgtUserLike;
import com.intellagric.service.agritech.UserLikeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: cwq
 * @Date: 2019/2/28 19:41
 * @Description:
 */
@RequestMapping("/api/agt_user_like")
@Controller
public class UserLikeController {

    @Autowired
    private UserLikeService userLikeService;

    @RequestMapping("/add")
    @ResponseBody
    public ResponseMessage add(AgtUserLike userLike) {
        return userLikeService.addUserLike(userLike);
    }

    @RequestMapping("/like")
    public ResponseMessage like(AgtUserLike agtUserLike) {
        return userLikeService.cancelUserLike(agtUserLike);
    }

/*    @RequestMapping("/cancel")
    public ResponseMessage cancel(AgtUserLike agtUserLike) {
        return userLikeService.cancelUserLike(agtUserLike);
    }*/

    @RequestMapping("/delete")
    @ResponseBody
    public ResponseMessage delete(String id) {
        return userLikeService.deleteUserLike(id);
    }

    @RequestMapping("/edit")
    @ResponseBody
    public ResponseMessage edit(AgtUserLike userLike) {
        return userLikeService.editUserLike(userLike);
    }

    @RequestMapping("/{id}")
    @ResponseBody
    public AgtUserLike get(@PathVariable String id) {
        return userLikeService.getUserLikeById(id);
    }

    @RequestMapping("/list")
    @ResponseBody
    public LayuiDataGridResult getList() {
        return userLikeService.getUserLikeList();
    }

/*    @RequestMapping("/query")
    @ResponseBody
    public LayuiDataGridResult getListByVo(AgtUserLikeVo agtUserLikeVo, int page, int limit) {
        return userLikeService.getUserLikeListByVo(agtUserLikeVo, page, limit);
    }*/

    @RequestMapping("/page")
    @ResponseBody
    public LayuiDataGridResult getPage(int page, int limit) {
        return userLikeService.getUserLikeByPage(page, limit);
    }
}
